<%@include file="../context.jsp"%>
<script type="text/javascript">
	$(document)
			.ready(
					function() {
						var code = $("#ticker").val();
						var name = $("#companyName").val();

						if (code == null && code == '') {
							code = null;
						}
						if (name == null && name == '') {
							name = null;
						}
						updateCharts(false, 'snContainer', 'snCurrentPage',
								'line', null, null, code, name);

						createPaging("/StockScreener/snapshot/main.html",
								'snContentDiv');

						paginationNextBtn("${pageContext.request.contextPath}/snapshot/list.html");
					});

	function paginationNextBtn(baseUrl) {
		var snShotDiv = $("div:visible[id*=snContentDiv]").attr("id");
		if (baseUrl != null) {
			$('#pageNum').on('keypress', function(event) {
				if (event.which == '13') {
					pageNumber = $(this).val();

					var code = $("#ticker").val();
					var name = $("#companyName").val();
					
					if (code == null || code == '') {
						code = null;
					}
					if (name == null || name == '') {
						name = null
					}
					
					$.ajax({
						url : baseUrl,
						type : "POST",
						data : {
							name : name,
							code : code,
							page : pageNumber
						},
						success : function(data) {
							replaceExisiting(data, snShotDiv);
						}

					});
				}
			});
		}
	}
</script>
<div id="snContentDiv" snshot="1" class="tab-content">
	<c:forEach var="shareResult" items="${data.pageData}">
		<div class="tab-pane active" id="overview">
			<div class="stock_screener_wrapper">
				<div class="row-fluid">
					<div class="span12">
						<div class="span3"></div>
						<div class="stock_screener_wrapper_left span6">
							<div class="row-fluid">
								<div class="comp_name_div span4">
									<h5>${shareResult.companyName}</h5>
								</div>
								<div class="comp_ticker_div span2">
									<span class="comp_ticker">[${shareResult.ticker}]</span>
								</div>
							</div>
							<div id="snContainer_${shareResult.ticker.split("\\.", 2)[0]}${shareResult.ticker.split("\\.", 2)[1]}"></div>
						</div>
						<div class="span3"></div>
					</div>
				</div>
				<div class="row-fluid stock_screener_wrapper_left">
					<div class="table_left">
						<table class="general_table" width="33%" border="1">
							<tr>
								<td style="line-height: 10px;" colspan="2">General</td>
							</tr>
							<tr class="white_bg">
								<td>Index</td>
								<td>${shareResult.index}</td>
							</tr>
							<tr class="white_bg">
								<td>Sector</td>
								<td>${shareResult.sector}</td>
							</tr>
							<tr class="white_bg">
								<td>Share price (LKR)</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.currentSharePrice}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Mkt cap (LKR mn)</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="0" minFractionDigits="0"
										value="${shareResult.marketCap}" /></td>
							</tr>
							<tr class="white_bg">
								<td>No. of shares issued (mn)</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="0" minFractionDigits="0"
										value="${shareResult.noOfShareIssued}" /></td>
							</tr>

							<tr>
								<td style="line-height: 10px;" colspan="2">Ownership</td>
							</tr>
							<tr class="white_bg">
								<td>Insider ownership %</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.insiderOwnership}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Insider transactions %</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.insiderTransaction}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Institutional ownership %</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.institutionalOwnership}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Institutional transactions %</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.institutionalTransaction}" /></td>
							</tr>
							<tr>
								<td style="line-height: 10px;" colspan="2">Liquidity</td>
							</tr>
							<tr class="white_bg">
								<td>Free float (LKR mn)</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="0" minFractionDigits="0"
										value="${shareResult.freeFloatShareprice}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Free float (No. of shares)</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.freeFloatShares}" /></td>
							</tr>
							<tr>
								<td style="line-height: 10px;" colspan="2">Fundamentals and
									Valuations</td>
							</tr>
							<tr class="white_bg">
								<td>PER (trailing)</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}" value="${shareResult.per}" /></td>
							</tr>

							<tr class="white_bg">
								<td>PER last FY</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.perLastFy}" /></td>
							</tr>
							<tr class="white_bg">
								<td>PBV (X)</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}" value="${shareResult.pbv}" /></td>
							</tr>
							<tr class="white_bg">
								<td>DY %</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}" value="${shareResult.dy}" /></td>
							</tr>
							<tr class="white_bg">
								<td>ROE %</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}" value="${shareResult.roe}" /></td>
							</tr>
							<tr class="white_bg">
								<td>ROA %</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}" value="${shareResult.roa}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Cash per share (LKR)</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.cashPerShare}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Dividend pay out</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.devidentPayOut}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Current ratio</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.currenRatio}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Debt to equity %</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.debitToequity}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Gearing %</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.gearing}" /></td>
							</tr>
							<tr class="white_bg">
								<td>&nbsp;</td>
								<td>&nbsp;</td>
							</tr>
							<tr class="white_bg">
								<td>&nbsp;</td>
								<td>&nbsp;</td>
							</tr>

						</table>
						<table class="growth_table" width="33%" border="1">
							<tr>
								<td style="line-height: 10px;" colspan="2">Growth</td>
							</tr>
							<tr class="white_bg">
								<td>Quarterly revenue growth YoY</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.qtrYoyRevenue}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Quarterly revenue growth QoQ</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.qtrQoqRevenue}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Last 12m revenue growth YoY</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.fourQtrRevenue}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Last FY revenue growth YoY</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.oneYearRevenue}" /></td>
							</tr>
							<tr class="white_bg">
								<td>5 year revenue growth</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.fiveYearRevenue}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Quarterly EPS growth YoY</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.qtrYoyEps}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Quarterly EPS growth QoQ</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.qtrQoqEps}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Last 12m EPS growth YoY</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.fourQtrEps}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Last FY EPS growth YoY</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.oneYearEps}" /></td>
							</tr>
							<tr class="white_bg">
								<td>5 year EPS growth YoY</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.fiveYearEps}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Quarterly EBITDA growth YoY</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.qtrYoyEbitda}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Quarterly EBITDA growth QoQ</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.qtrQoqEbitda}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Last 12m EBITDA growth YoY</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.fourQtrEbitda}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Last FY EBITDA growth YoY</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.oneYearEbitda}" /></td>
							</tr>
							<tr class="white_bg">
								<td>5 year EBITDA growth</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.fiveYearEbitda}" /></td>
							</tr>
							<tr>
								<td style="line-height: 10px;" colspan="2">Share
									performance</td>
							</tr>
							<tr class="white_bg">
								<td>1W</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.oneWeekPricePer}" /></td>
							</tr>
							<tr class="white_bg">
								<td>1M</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.oneMonthPricePer}" /></td>
							</tr>
							<tr class="white_bg">
								<td>3M</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.threeMonthPricePer}" /></td>
							</tr>
							<tr class="white_bg">
								<td>6M</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.sixMonthPricePer}" /></td>
							</tr>
							<tr class="white_bg">
								<td>12M</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.twelMonthPricePer}" /></td>
							</tr>
							<tr class="white_bg">
								<td>24M</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.pricePer24M}" /></td>
							</tr>
							<tr class="white_bg">
								<td>YTD</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.ytdPricePer}" /></td>
							</tr>
							<tr class="white_bg">
								<td>1W volatility</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.oneWeekVolatility}" /></td>
							</tr>
							<tr class="white_bg">
								<td>1M volatility</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.oneMonthVolatility}" /></td>
							</tr>
							<tr class="white_bg">
								<td>3M average volume</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="0" minFractionDigits="0"
										value="${shareResult.avarageVolume}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Relative volume</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.relativeVolume}" /></td>
							</tr>
						</table>
						<table class="technical_table" width="33%" border="1">
							<tr>
								<td style="line-height: 10px;" colspan="2">Technical’s</td>
							</tr>
							<tr class="white_bg">
								<td>Distance to SMA10</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.sma10}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Distance to SMA20</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.sma20}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Distance to SMA50</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.sma50}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Distance to SMA100</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.sma100}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Distance to SMA200</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.sma200}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Dist. to 12m high</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.twelMonthHigh}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Dist. to 12m low</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.twelMonthLow}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Dist. to 3m high</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.threeMHigh}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Dist. to 3m low</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.threeMLow}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Dist. to 1m high</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.oneMHigh}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Dist. to 1m low</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.oneMLow}" /></td>
							</tr>
							<tr class="white_bg">
								<td>RSI (14)</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}" value="${shareResult.rsi}" /></td>
							</tr>
							<tr class="white_bg">
								<td>ATR</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}" value="${shareResult.atr}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Beta – 36M</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.thertyMonthBeta}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Beta – 60M</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.insiderTransaction}" /></td>
							</tr>
							<tr>
								<td style="line-height: 10px;" colspan="2">Today’sprice
									performance</td>
							</tr>
							<tr class="white_bg">
								<td>Share price</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.currentSharePrice}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Today’s change</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.change}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Volume</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="0" minFractionDigits="0"
										value="${shareResult.volume}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Gap</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}" value="${shareResult.gap}" /></td>
							</tr>
							<tr class="white_bg">
								<td>Change from open</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.changeOpenToNow}" /></td>
							</tr>
							<tr class="white_bg">
								<td>1D volatility</td>
								<td class="number_align"><fmt:formatNumber
										maxFractionDigits="${MaxFraction}"
										minFractionDigits="${MinFraction}"
										value="${shareResult.onedayVolatality}" /></td>
							</tr>
							<tr class="white_bg">
								<td>&nbsp;</td>
								<td>&nbsp;</td>
							</tr>
							<tr class="white_bg">
								<td>&nbsp;</td>
								<td>&nbsp;</td>
							</tr>
							<tr class="white_bg">
								<td>&nbsp;</td>
								<td>&nbsp;</td>
							</tr>
							<tr class="white_bg">
								<td>&nbsp;</td>
								<td>&nbsp;</td>
							</tr>
							<tr class="white_bg">
								<td>&nbsp;</td>
								<td>&nbsp;</td>
							</tr>

						</table>
					</div>
				</div>
			</div>



			<!-- document section -->
			<div>
				<c:forEach var="doc" items="${shareResult.comanyDocument }">
					<a target="_blank" href="${companyDocDir }${doc.fileName}">
						${doc.name}</a>
				</c:forEach>
			</div>
			<!-- end document section -->
	</c:forEach>
	<input type="hidden" id="snCurrentPage" value="${data.currentPageNo}" />
	<!-- paging section -->
	<div class="pagination pagination-center">
		<ul>
			<li><input value="${data.currentPageNo}" style="width: 50px;"
				type="number" min="0" max="${data.totalNoOfPages }" id="pageNum">
			</li>
			<c:if test="${data.showPrev}">
				<li><a lang="${data.currentPageNo-1}" id="showPrev"
					href="javascript:void(0);">Prev</a></li>
			</c:if>
			<c:forEach begin="${data.startPageNo}" var="page"
				end="${data.endPageNo}">
				<li><a
					<c:if test="${data.currentPageNo==page}">style="background-color:#79BAEC"</c:if>
					lang="${page}" id="pageNum_${page }" href="javascript:void(0);">${page}</a></li>
			</c:forEach>
			<c:if test="${data.showNext}">
				<li><a lang="${data.currentPageNo+1}" id="showNext"
					href="javascript:void(0);">Next</a></li>
			</c:if>
			<li>${data.totalNoOfPages }</li>

		</ul>
	</div>
	<!-- end pagination -->
</div>